package com.ruoyi.project.lely.controller;


import com.ruoyi.common.R;
import com.ruoyi.project.lely.service.LyCartService;
import com.ruoyi.project.lely.service.LyCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author luoyong
 * @Desc: 购物车
 * @since 2022-01-13
 */
@Api(tags = "Mini-购物车")
@RestController
@RequestMapping("/mini/cart")
public class CartController {

    @Autowired
    private LyCategoryService categoryService;
    @Autowired
    private LyCartService cartService;

    @ApiOperation("查询购物车数据")
    @GetMapping(value = {"/get"})
    public R get() {
        return cartService.get();
    }

    @ApiOperation("查询当前分类数据")
    @GetMapping("/current")
    public R current(@ApiParam(value = "父分类id", required = true) @RequestParam Long id) {
        return categoryService.getCurrent(id);
    }
}

